package 重要代码;

import java.util.Arrays;

public class 冒泡排序 {
    public static void main(String[] args) {
      int arr[]={2,4,1,6,5,2,45,};
        System.out.println(Arrays.toString(test02(arr)));
    }
    public static  int[] test02(int[]arr){

        for (int i = 0; i <arr.length ; i++) {
            for (int j = 0; j <arr.length-1-i ; j++) {
               if(arr[j]>arr[j+1]){
                   arr[j]=arr[j]^arr[j+1];
                   arr[j+1]=arr[j]^arr[j+1];
                   arr[j]=arr[j]^arr[j+1];
               }

            }

        }
        return arr ;
    }

}
